<?php
namespace Home\Controller;
use Think\Controller;
class ShowjsonController extends Controller {
    public function index(){
    	$this->display();
    }

    function getlist(){
    	$shows = D('shows');
    	$info = $shows->select();
    	$this->ajaxReturn($info);
    }

    function fatie($cnt){
    	$shows_id = I('get.shows_id');
    	$users_id = I('get.users_id');
    	$cnt = I('get.cnt');
    	$shows_cmt = D('shows_cmt');
    	$shows_cmt -> create();
		$res = $shows_cmt->add();
		if($res == 1) {
			$json = array('success' =>$res);
        	echo json_encode($json);
		} 
		else{
			$json = array('fail' =>0);
        	echo json_encode($json);
		}
    }

    function pinglun(){
    	//详情
    	$shows_id = I('get.shows_id');
    	$shows = D('shows');
    	$info = $shows->where("shows_id='$shows_id'")->select();

    	//评论
    	$shows_cmt = D('shows_cmt');
    	$re = $shows_cmt->where("shows_id='$shows_id'")->select();
    	$json = array(
    		'info'  =>$info,
    		're'    =>$re
    		);
    	echo json_encode($json);
    }

    function fapinglun(){
    	$shows_id = I('get.shows_id');
    	$users_id = I('get.users_id');
    	$cnt = I('get.cnt');
    	$shows_cmt = D('shows_cmt');
    	$shows_cmt -> create();
		$res = $shows_cmt->add();
		if($res == 1) {
			$json = array('success' =>$res);
        	echo json_encode($json);
		} 
		else{
			$json = array('fail' =>0);
        	echo json_encode($json);
		}
    }
}